<?php 
include("common/conn.php");
include("./tool/UpFileTool.class.php");
header("Content-type:text/html;charset=utf-8");

// 获取子类目
if ($_REQUEST[act] == 'getzileimu') {
	$query = mysql_query("select * from zifenlei where fenleiid=".$_REQUEST[leimu]);
	while ($row = mysql_fetch_assoc($query)) {
		$zifenlei[] = $row;
	}
	echo json_encode($zifenlei);
	exit();
}
// 获取子类目 end

if($_GET['action']=="ok"){

	if (empty($_POST['zileimu'])) {
		$zileimu = '';
	}else{
		$zileimu = implode(',', $_POST['zileimu']);	
	}

    if (empty($_POST['coupon_ids'])) {
		$coupon_ids = '';
	}else{
		$coupon_ids = implode(',', $_POST['coupon_ids']);
	}

	if ($_FILES[upfile1][tmp_name]!='') {
		$UpFileTool=new UpFileTool('upfile1');
		$UpFileTool->sumbImage($w=100, $h=100,1);
		$UpFileTool->upFile();
		$headimages = $UpFileTool->sumbImage;
		//$srcimages = $UpFileTool->srcImage;
	}

	if ($_FILES[upfile2][tmp_name]!='') {
		$UpFileTool=new UpFileTool('upfile2');
		$UpFileTool->sumbImage($w=300, $h=300);
		$UpFileTool->upFile();
		$images = $UpFileTool->sumbImage;
		$srcimages = $UpFileTool->srcImage;
	}


	if ($_FILES[licence][name][0] !='') {
		$UpFileTool=new UpFileTool('licence');
		$UpFileTool->multiImage($w=500, $h=500);
		$licence = $UpFileTool->multiSumbImage;
		$srclicence = $UpFileTool->multiSrcImage;
	}
	$date=date("Y-m-d H:i:s");

	$htservice = implode(',', $_POST[htservice]);
	$kgservice = implode(',', $_POST[kgservice]);

	$srat=mysql_query("INSERT INTO shop(Freight_dir,short_name,coupon_ids,qq,address,name,leimu,zileimu,city,weixin,phone,shop_daima,password,content,images,srcimages,longitude,latitude,huodong_miaoshu,wenzi_miaoshu,jiage_miaoshu,vr_dizhi,distribution_fee,recommend,song_da,htservice,kgservice,licence,freight_ins,head_pic) VALUES ('$_POST[Freight_dir]','$_POST[short_name]','$coupon_ids','$_POST[qq]','$_POST[address]','$_POST[name]','$_POST[leimu]','$zileimu','$_POST[city]','$_POST[weixin]','$_POST[phone]','$_POST[shop_daima]','$_POST[password]','$_POST[content]','$images','$srcimages','$_POST[jingdu]','$_POST[weidu]','$_POST[huodong_miaoshu]','$_POST[wenzi_miaoshu]','$_POST[jiage_miaoshu]','$_POST[vr_dizhi]','$_POST[distribution_fee]','$_POST[recommend]','$_POST[song_da]','$htservice','$kgservice','$srclicence','$_POST[freight_ins]','$headimages')");
	echo "<script>alert('添加成功');window.location.href='shequ.php';</script>";
}

if($_GET['ch']=="ok"){
	if (empty($_POST['zileimu'])) {
		$zileimu = '';
	}else{
		$zileimu = implode(',', $_POST['zileimu']);	
	}

	if (empty($_POST['coupon_ids'])) {
		$coupon_ids = '';
	}else{
		$coupon_ids = implode(',', $_POST['coupon_ids']);	
	}

	$htservice = implode(',', $_POST[htservice]);
	$kgservice = implode(',', $_POST[kgservice]);
    
	$srat1=mysql_query("update shop set Freight_dir='".$_POST['Freight_dir']."',short_name='".$_POST['short_name']."',coupon_ids='".$coupon_ids."',qq='".$_POST['qq']."',freight_ins='".$_POST['freight_ins']."',name='".$_POST['name']."',content='".$_POST['content']."',weixin='".$_POST[weixin]."',phone='".$_POST['phone']."',shop_daima='".$_POST['shop_daima']."',password='".$_POST['password']."',city='".$_POST['city']."',address='".$_POST['address']."',leimu='".$_POST['leimu']."',zileimu='".$zileimu."',longitude='".$_POST['jingdu']."',latitude='".$_POST['weidu']."',huodong_miaoshu='".$_POST['huodong_miaoshu']."',distribution_fee='".$_POST['distribution_fee']."',recommend='$_POST[recommend]',song_da='$_POST[song_da]',htservice='$htservice',kgservice='$kgservice',wenzi_miaoshu='".$_POST[wenzi_miaoshu]."',jiage_miaoshu='".$_POST[jiage_miaoshu]."',vr_dizhi='".$_POST[vr_dizhi]."' where shopid=".$_REQUEST['id']);

	if ($_FILES[upfile1][tmp_name]!='') {
		$UpFileTool=new UpFileTool('upfile1');
		$UpFileTool->sumbImage($w=100, $h=100,1);
		$UpFileTool->upFile();
		$headimages = $UpFileTool->sumbImage;
		mysql_query("update shop set head_pic='".$headimages."' where shopid=".$_REQUEST['id']);
	}

	if ($_FILES[upfile2][tmp_name]!='') {
		$UpFileTool=new UpFileTool('upfile2');
		$UpFileTool->sumbImage($w=300, $h=300);
		$UpFileTool->upFile();
		$images = $UpFileTool->sumbImage;
		$srcimages = $UpFileTool->srcImage;
		mysql_query("update shop set srcimages='".$srcimages."', images='".$images."' where shopid=".$_REQUEST['id']);
	}

	if ($_FILES[licence][name][0] !='') {
		$UpFileTool=new UpFileTool('licence');
		$UpFileTool->multiImage($w=500, $h=500);
		$licence = $UpFileTool->multiSumbImage;
		$srclicence = $UpFileTool->multiSrcImage;
		mysql_query("update shop set licence='".$srclicence."' where shopid=".$_REQUEST['id']);
	}
	echo "<script>alert('更新成功');window.location.href='shequ.php';</script>";

}


if($_GET['id']!=""){
	$rert30=mysql_query("select * from shop where shopid=".$_GET['id']);
	$sdg30=mysql_fetch_array($rert30);

	$licences = explode(',', $sdg30[licence]);
	$sum = count($licences);
}

// 查询海淘买家服务 
$query = mysql_query("select * from buyer_service where type = 0");
while ($row = mysql_fetch_assoc($query)) {
	$htservice[] = $row;
}
// 查询海淘买家服务 end

// 查询快购买家服务 
$query = mysql_query("select * from buyer_service where type = 1");
while ($row = mysql_fetch_assoc($query)) {
	$kgservice[] = $row;
}
// 查询快购买家服务 end
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>e网批发管理后台</title>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	.car_mode{position: relative;left:0px; width:100%;  text-align:left; line-height:30px; margin-top:15px; border:0px;   overflow:hidden; padding-bottom:10px;}
	.indexfloat{ position:relative;float:left; margin-left:0px; margin-top:0px;}

</style>
</head>

<body>

	<!--header-->
	<?php include("common/header.php");?>
	<!--header end-->


	<!-- staqrt subnav -->
	<div id="sub_nav">

		<div id="subnav_wrap" class="container_12">

			<!-- start sub nav list -->
			<div id="subnav" class=" grid_12">

				<ul>
					<li><a href="shequ.php" class="sub_nav_active">商家管理</a></li>
					<li><a href="brokerage.php">佣金管理</a></li>

				</ul>


			</div>

		</div>


	</div>
	<div class="container_12" style="margin-bottom:150px;">
		<form action="?<?php if($_GET['id']!=""){echo "ch=ok";}else{echo "action=ok";} ?>&id=<?php echo $_GET['id'];?>" method="post" enctype="multipart/form-data" id="form">
			<h2>添加商家</h2> 
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					商家地址
				</div> 
				<div class="indexfloat" style="width:79%;">
					<a href="gruop_location.php?id=<?php echo $_GET[id]; ?>"><input type="text" class="text required" name="address" id="ea55_title"  value="<?php if($_REQUEST['title']!=""){echo $_REQUEST['title'];}else{echo $sdg30[address];}?>" autocomplete="off" x-webkit-speech="" speech="" style=" width:400px;"  placeholder="<?php if($_REQUEST['title']!=""){echo $_REQUEST['title'];}else{echo "点击获取地址";}?>"></a>
				</div>

			</div>
			<!--收货信息 end-->	
			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					经度
				</div> 
				<div class="indexfloat" style="width:79%;">
					<input readonly="readonly" type="text" class="text required" value="<?php if ($_REQUEST[jingdu]!=''){
                            echo $_REQUEST[jingdu];
                        }elseif ($sdg30[longitude]!='') {
                            echo $sdg30[longitude];
                        } ?>" />
				</div>



			</div>

			<!--收货信息 end-->
			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					纬度
				</div> 
				<div class="indexfloat" style="width:79%;">
					<input readonly="readonly" type="text" class="text required" value="<?php if ($_REQUEST[weidu]!=''){
                            echo $_REQUEST[weidu];
                        }elseif ($sdg30[latitude]!='') {
                            echo $sdg30[latitude];
                        } ?>" />
				</div>



			</div>
			<!--收货信息 end-->
			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					店铺全称
				</div> 
				<div class="indexfloat" style="width:79%;">
					<input name="name" type="text" class="text required" value="<?php echo $sdg30[name]; ?>" />
				</div>
			</div>

			<!--收货信息 end-->
             <div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					店铺简称
				</div> 
				<div class="indexfloat" style="width:79%;">
					<input name="short_name" type="text" class="text required" value="<?php echo $sdg30[short_name]; ?>" />
				</div>
			</div>

			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					厂商头像<span style="font-size: 8px;font-weight: normal;"><!-- (请上传600*250像素大小的图片) --></span>
				</div> 

				<div class="indexfloat" style="width:79%;" >

					<input name="upfile1" type="file" <?php if (empty($_REQUEST[id])) { ?>class="required"<?php } ?>/><?php if($_GET[id]!=""){?><img src="<?php echo $sdg30[head_pic];?>" width='80'/><?php }?>
				</div>

			</div>
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					厂商主图
				</div> 

				<div class="indexfloat" style="width:79%;" >
					<input name="upfile2" type="file" <?php if (empty($_REQUEST[id])) { ?>class="required"<?php } ?>/><?php if($_GET[id]!=""){?><img src="<?php echo $sdg30[srcimages];?>" width='300'/><?php }?>
					<span style="font-size: 8px;font-weight: normal;"> (请上传12:5像素大小的图片) </span>
				</div>

			</div>

			<!--收货信息 end-->

			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					营业执照<span style="font-size: 8px;font-weight: normal;"><!-- (请上传500*500像素大小的图片) --></span>
				</div> 

				<div class="indexfloat" style="width:79%;" >
					<input name="licence[]" multiple type="file" <?php if (empty($_REQUEST[id])) { ?> class="required" <?php } ?>/>
					<?php  if ($licences[0] != '') {
						for ($i=0; $i < $sum; $i++) { ?>
						<img src="<?php echo $licences[$i];?>" width="500" height="auto"/>
					<?php }} ?>


				</div>

			</div>

			<!--收货信息 end-->

			<!--收货信息-->
			<div class="car_mode" >

				<div class="indexfloat" style="width:15%; margin-left:5%;">
					商家分类
				</div> 

				<div class="indexfloat" style="width:79%;" >


					<?php 
					$rert37=mysql_query("select * from categroy   order by cateid desc ");$i=1;
					while($sdg37=mysql_fetch_array($rert37)){?>

					<input name="leimu" class="required"   <?php if($sdg30['leimu']==$sdg37[cateid])
					{ 
						echo "checked='checked'";}elseif($i==1){echo "checked='checked'";}?> type="radio" value="<?php echo $sdg37[cateid];?>"><?php echo $sdg37[name];?>
					<?php $i++;} ?>

				</div>

			</div>

<!--收货信息 end-->

<!--子分类-->
			<div class="car_mode" >
				<div class="indexfloat" style="width:15%; margin-left:5%;">
					子分类
				</div> 
				<div class="indexfloat zileimu" style="width:79%;" >
				<?php 
				$query = mysql_query("select * from zifenlei where fenleiid=".$sdg30[leimu]);
				while ($row = mysql_fetch_assoc($query)) {
				?>
					<input type="checkbox" class="required" name="zileimu[]" <?php if (strpos($sdg30[zileimu], $row[id]) || strpos($sdg30[zileimu], $row[id]) === 0) { ?> checked="checked" <?php } ?> value="<?php echo $row[id]; ?>">
					<?php echo $row[name]; ?>
				<?php } ?>
				</div>
			</div>

<!--子分类 end-->

<!--平台优惠券-->
			<div class="car_mode" >
				<div class="indexfloat" style="width:15%; margin-left:5%;">
					平台优惠券
				</div> 
				<div class="indexfloat" style="width:79%;" >
				<?php
				//优惠券类型，1 新人专享优惠券，2 普通平台优惠券，3 商家优惠券
                $today = date("Y-m-d");
				$query = mysql_query("SELECT * FROM  coupon  where coupon.type=1  or coupon.type=2  and startdate<='".$today."'  and  enddate>='".$today."'");
				while ($row = mysql_fetch_assoc($query)) {
				?>
					<input type="checkbox" name="coupon_ids[]" <?php if (strpos($sdg30[coupon_ids], $row[couponid]) || strpos($sdg30[coupon_ids], $row[couponid]) === 0) { ?> checked="checked" <?php } ?> value="<?php echo $row[couponid]; ?>">
					<?php echo $row[title]; ?><span  style="color:red;">(满<?php echo $row[top_price]; ?>，送<?php echo $row[price]; ?>)</span>
				<?php } ?>
				</div>
			</div>

<!--平台优惠券 end-->

<!--收货信息-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		选择市场
	</div> 

	<div class="indexfloat" style="width:79%;" >


		<?php 

		$rert37=mysql_query("select * from city   order by id desc ");$i=100;

		while($sdg37=mysql_fetch_array($rert37)){?>

		<input name="city"   <?php if($sdg30['city']==$sdg37[id])
		{ echo "checked='checked'";}elseif ($i==100) {
			echo "checked='checked'";
		}?> type="radio" value="<?php echo $sdg37[id];?>"onclick="zis(<?php echo $i;?>)"><?php echo $sdg37[city];?>

		<?php $i++;} ?>


	</div>

</div>
<!--收货信息 end-->


<input name="jingdu" type="hidden"  value="<?php if($_REQUEST['jingdu']!=""){echo $_REQUEST['jingdu'];}else{echo $sdg30[longitude];}?>" autocomplete="off" x-webkit-speech="" speech="" style=" width:200px;"  class="ea55_posts" placeholder="<?php if($_REQUEST['jingdu']!=""){echo $_REQUEST['jingdu'];}else{echo "点击获取地址";}?>"><input type="hidden" name="weidu"   value="<?php if($_REQUEST['weidu']!=""){echo $_REQUEST['weidu'];}else{echo $sdg30[latitude];}?>" autocomplete="off" x-webkit-speech="" speech="" style=" width:200px;"  class="ea55_posts" placeholder="<?php if($_REQUEST['weidu']!=""){echo $_REQUEST['weidu'];}else{echo "点击获取地址";}?>">

<!--收货信息-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		登录账号/厂商代码
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="shop_daima" type="text" class="text required" value="<?php echo $sdg30[shop_daima]; ?>"/>
	</div>

</div>

<!--收货信息 end-->
<!--收货信息-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		登录账号/注册手机号码
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="phone" type="text" class="text required" value="<?php echo $sdg30[phone]; ?>"/>
	</div>
</div>

<!--收货信息 end-->

<!--登录密码-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		登录密码
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="password" type="text" class="text required" value="<?php echo $sdg30[password]; ?>"/>
	</div>

</div>

<!--登录密码 end-->

<!--收货信息-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		QQ
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="qq" type="text" class="text required" value="<?php echo $sdg30[qq]; ?>"/>
	</div>
</div>

<!--收货信息 end-->

<!--微信账号-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		微信账号
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="weixin" type="text" class="text required" value="<?php echo $sdg30[weixin]; ?>"/>
	</div>

</div>

<!--微信账号 end-->

<!--运费说明-->
<div class="car_mode">

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		运费说明
	</div> 
	<div class="indexfloat" style="width:79%;">
		<textarea name="Freight_dir" cols="20" rows="5" class="required"><?php echo $sdg30[Freight_dir]; ?></textarea>
	</div>

</div>

<!--运费说明end-->

<!--起送价格-->
<div class="car_mode" >
	<div class="indexfloat" style="width:15%; margin-left:5%;">
		活动描述
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="huodong_miaoshu" type="text" class="text required" <?php if ($sdg30[huodong_miaoshu]!='') {
				echo "value=$sdg30[huodong_miaoshu]";
			}else{
				echo "placeholder='请填写活动描述' value=''";
			}  ?>/>
	</div>
</div>
<!--起送价格 end-->

<!--起送价格-->
<div class="car_mode" >
	<div class="indexfloat" style="width:15%; margin-left:5%;">
		文字描述
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="wenzi_miaoshu" type="text" class="text required" <?php if ($sdg30[wenzi_miaoshu]!='') {
			echo "value=$sdg30[wenzi_miaoshu]";
			}else{
			echo "placeholder='请填写活动文字' value=''";
			}  ?>/>
	</div>
</div>
<!--起送价格 end-->	

<!--起送价格-->
<div class="car_mode" >
	<div class="indexfloat" style="width:15%; margin-left:5%;">
		价格描述
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="jiage_miaoshu" type="text" class="text required" <?php if ($sdg30[jiage_miaoshu]!='') {
				echo "value=$sdg30[jiage_miaoshu]";
			}else{
				echo "placeholder='请填写活动价格' value=''";
			}  ?>/>
	</div>
</div>
<!--起送价格 end-->	

<!--起送价格-->
<div class="car_mode" >
	<div class="indexfloat" style="width:15%; margin-left:5%;">
		VR链接
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="vr_dizhi" type="text" class="text required escaped" <?php if ($sdg30[vr_dizhi]!='') {
				echo "value=$sdg30[vr_dizhi]";
			}else{
				echo "placeholder='请填写VR地址链接'";
			}  ?>/>
	</div>
</div>
<!--起送价格 end-->	

<!-- 快递 -->
<div class="car_mode"  style="display:none">

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		快递
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="distribution_fee" type="text" class="text required" value="<?php if ($sdg30[distribution_fee]!='') {
			echo $sdg30[distribution_fee];
		}else{
			echo 0;
		}  ?>"/>
	</div>
</div>

<!-- 快递 end -->
<!-- 送达时间 -->
<div class="car_mode"  style="display:none">

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		送达时间
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="song_da" type="text" class="text required" value="<?php if ($sdg30[song_da]!='') {
			echo $sdg30[song_da];
		}else{
			echo 30;
		}  ?>"/>
		<label>分钟</label>
	</div>
</div>

<!-- 送达时间 end -->

<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		是否支持运费险
	</div> 
	<div class="indexfloat" style="width:79%;">
		<input name="freight_ins" type="radio" <?php if($sdg30[freight_ins]==0||$_REQUEST[shopid]==''){echo 'checked="checked"';}?> value="0"/>否&nbsp;&nbsp;
		<input name="freight_ins" <?php if($sdg30[freight_ins]==1){echo 'checked="checked"';}?> type="radio" value="1"/>是
	</div>
</div>

<!--海淘买家服务-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		海淘买家服务
	</div> 
	<div class="indexfloat" style="width:79%;">
		<?php foreach ($htservice as $v) { ?>
			<input type="checkbox" name="htservice[]" <?php if (strpos($sdg30[htservice], $v[id]) || strpos($sdg30[htservice], $v[id]) === 0) { ?> checked="checked" <?php } ?> value="<?php echo $v[id]; ?>">
			<?php echo $v[name]; ?>
		<?php } ?>
	</div>
</div>

<!--海淘买家服务 end-->


<!-- 快购买家服务 -->
<div class="car_mode" style="display:none">

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		快购买家服务
	</div> 
	<div class="indexfloat" style="width:79%;">
		<?php foreach ($kgservice as $v) { ?>
			<input type="checkbox" name="kgservice[]" <?php if (strpos($sdg30[kgservice], $v[id]) || strpos($sdg30[kgservice], $v[id]) === 0) { ?> checked="checked" <?php } ?> value="<?php echo $v[id]; ?>">
			<?php echo $v[name]; ?>
		<?php } ?>
	</div>
</div>

<!-- 快购买家服务 end -->

<!--收货信息-->
<div class="car_mode" >

	<div class="indexfloat" style="width:15%; margin-left:5%;">
		商家介绍
	</div> 
	<div class="indexfloat" style="width:79%;">
	    <textarea name="content" cols="20" rows="5" class="required"><?php echo $sdg30[content]; ?></textarea>
	</div>
</div>
<!--收货信息 end-->


</form>  
</div>
<!--收货信息-->
<div class="submit_div">		
	<input name="" type="submit" value="提交" id="submit"/>
</div>
<!--收货信息 end-->
</body>
</html>
<script type="text/javascript">
	function zi(n)
	{
		for(var i=1;i<=50;i++)
		{
			document.getElementById(i).style.display="none"; 
			document.getElementById(n).style.display="block";  
		}

	}

	function zis(n)
	{
		for(var i=100;i<=150;i++)
		{
			document.getElementById(i).style.display="none"; 
			document.getElementById(n).style.display="block";  
		}

	}
	// 提交表单
	$('#submit').click(function(){
		$('#form').submit();
	})
	// 提交表单 end
	// 表单验证
	$().ready(function() {
		$("#form :not(.escaped)").validate();
	});
	// 表单验证 end
	// 获取子分类
	$('input[name="leimu"]').change(function(){
		$('.zileimu').empty();
		var url = 'addshop.php?act=getzileimu&leimu='+$(this).val();
		$.get(url,function(data){
			var getzileimu = JSON.parse(data);
			for(var i=0;i<getzileimu.length;i++){
				$('.zileimu').append("<input type='checkbox' name='zileimu[]' value='"+getzileimu[i].id+"'>"+getzileimu[i].name+"");
			};
		});
	})
	// 获取子分类 end
</script>